﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Forms;
using System.Data.OleDb;
using MH3GAPP.Dal;
using MH3GAPP.Bll;
using MH3GAPP.Common;
using System.Data;

namespace MH3GAPP.Bll
{
    class MH3GBll
    {
        private MH3GDal mh3gDal = new MH3GDal();

        public void changeDone(int inputID, bool isDone)
        {
            try
            {
                OleDbTransaction trans = null;
                OleDbConnection oleDB = DbManager.GetInstance().GetOleConection();
                trans = oleDB.BeginTransaction();

                int TMP = mh3gDal.changeDone(trans, inputID, isDone);

                trans.Commit();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        public void inputDamage(int inputID, int damage)
        {
            try
            {
                OleDbTransaction trans = null;
                OleDbConnection oleDB = DbManager.GetInstance().GetOleConection();
                trans = oleDB.BeginTransaction();

                int TMP = mh3gDal.inputDamage(trans, inputID, damage);

                trans.Commit();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

        public DataTable getArmDisplayDate(
            string srechStr,
            bool b1,//头
            bool b2,//胸
            bool b3,//手
            bool b4,//腰
            bool b5,//脚
            bool b6,//男
            bool b7,//女
            bool b8,//近
            bool b9,//远
            int amrRare)//等级
        {
            DataTable dt = new DataTable();

            try
            {
                OleDbTransaction trans = null;
                OleDbConnection oleDB = DbManager.GetInstance().GetOleConection();
                trans = oleDB.BeginTransaction();

                dt = mh3gDal.getArmDisplayDate(trans, srechStr, b1, b2, b3, b4, b5, b6, b7, b8, b9, amrRare);

                trans.Commit();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }

            return dt;
        }


        public DataTable getArmPartIDForSearch(int partID, int bg, int mf)
        {
            DataTable dt = new DataTable();

            try
            {
                OleDbTransaction trans = null;
                OleDbConnection oleDB = DbManager.GetInstance().GetOleConection();
                trans = oleDB.BeginTransaction();

                dt = mh3gDal.getArmPartIDForSearch(trans, partID, bg, mf);

                trans.Commit();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }

            return dt;
        }

    }
}
